import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../home/home/home_view.dart';
import '../profile/profile/profile_view.dart';
import '../push/push/push_view.dart';
import '../search/search_page/search_page_view.dart';
import '../video/video/video_view.dart';
import 'app_main_controller.dart';

class AppMainView extends StatelessWidget {
  const AppMainView({super.key});

  @override
  Widget build(BuildContext context) {
    return GetBuilder<AppMainController>(
      init: AppMainController(),
      tag: 'AppMainView',
      builder: (ctrl) {
        return CupertinoTabScaffold(
          tabBar: CupertinoTabBar(
            border: Border.all(
              color: Colors.transparent, // 或者使用 BorderSide.none
              width: 0,
            ),
            backgroundColor: Colors.transparent,
            items: const <BottomNavigationBarItem>[
              // _Paths.HOME + [Empty]
              BottomNavigationBarItem(
                icon: Icon(CupertinoIcons.home),
              ),
              BottomNavigationBarItem(
                icon: Icon(CupertinoIcons.search),
              ),
              BottomNavigationBarItem(
                icon: Icon(Icons.add_box_outlined),
              ),
              // _Paths.HOME + Routes.PROFILE
              BottomNavigationBarItem(
                icon: Icon(CupertinoIcons.videocam_circle),
              ),
              // _Paths.HOME + _Paths.PRODUCTS
              BottomNavigationBarItem(
                icon: Icon(Icons.account_box_rounded),
              ),
            ],
          ),
          tabBuilder: (context, index) {
            return CupertinoTabView(
              builder: (context) {
                switch (index) {
                  case 0:
                    return const HomeView();
                  case 1:
                    return const SearchPageView();
                  case 2:
                    return const PushView();
                  case 3:
                    return const VideoView();
                  case 4:
                    return const ProfileView();
                  default:
                    return Container();
                }
              },
            );
          },
        );
      },
    );
  }
}
